.class public Lcom/bitauto/autoeasy/selectcar/Object/CityParser;
.super Ljava/lang/Object;
.source "CityParser.java"


# static fields
.field private static final CITYID:Ljava/lang/String; = "CityId"

.field private static final CITYNAME:Ljava/lang/String; = "CityName"


# instance fields
.field private TAG:Ljava/lang/String;

.field private list:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/City;",
            ">;"
        }
    .end annotation
.end field

.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 34
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 31
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->url:Ljava/lang/String;

    .line 32
    const-string v0, "CityParser"

    iput-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->TAG:Ljava/lang/String;

    .line 35
    iput-object p1, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->url:Ljava/lang/String;

    .line 36
    return-void
.end method


# virtual methods
.method public Paser2Object()V
    .locals 9

    .prologue
    const-string v6, "CityValueSet"

    const-string v6, "CityItem"

    .line 41
    :try_start_0
    new-instance v6, Ljava/util/ArrayList;

    invoke-direct {v6}, Ljava/util/ArrayList;-><init>()V

    iput-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->list:Ljava/util/ArrayList;

    .line 44
    new-instance v5, Lorg/json/JSONObject;

    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->url:Ljava/lang/String;

    invoke-direct {v5, v6}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1

    .line 47
    .local v5, jObj:Lorg/json/JSONObject;
    :try_start_1
    const-string v6, "CityValueSet"

    invoke-virtual {v5, v6}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v6

    const-string v7, "CityItem"

    invoke-virtual {v6, v7}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v3

    .line 48
    .local v3, jArr:Lorg/json/JSONArray;
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v6

    if-lez v6, :cond_0

    .line 49
    const/4 v2, 0x0

    .local v2, i:I
    :goto_0
    invoke-virtual {v3}, Lorg/json/JSONArray;->length()I

    move-result v6

    if-lt v2, v6, :cond_1

    .line 71
    .end local v2           #i:I
    .end local v3           #jArr:Lorg/json/JSONArray;
    .end local v5           #jObj:Lorg/json/JSONObject;
    :cond_0
    :goto_1
    return-void

    .line 50
    .restart local v2       #i:I
    .restart local v3       #jArr:Lorg/json/JSONArray;
    .restart local v5       #jObj:Lorg/json/JSONObject;
    :cond_1
    invoke-virtual {v3, v2}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v6

    invoke-virtual {p0, v6}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->createCity(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/City;

    move-result-object v0

    .line 51
    .local v0, city:Lcom/bitauto/autoeasy/selectcar/Object/City;
    if-eqz v0, :cond_2

    .line 52
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->list:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    .line 49
    :cond_2
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    .line 55
    .end local v0           #city:Lcom/bitauto/autoeasy/selectcar/Object/City;
    .end local v2           #i:I
    .end local v3           #jArr:Lorg/json/JSONArray;
    :catch_0
    move-exception v6

    move-object v1, v6

    .line 56
    .local v1, e:Ljava/lang/Exception;
    :try_start_2
    const-string v6, "CityValueSet"

    invoke-virtual {v5, v6}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v6

    const-string v7, "CityItem"

    invoke-virtual {v6, v7}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v4

    .line 57
    .local v4, jO:Lorg/json/JSONObject;
    invoke-virtual {p0, v4}, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->createCity(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/City;

    move-result-object v0

    .line 58
    .restart local v0       #city:Lcom/bitauto/autoeasy/selectcar/Object/City;
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->list:Ljava/util/ArrayList;

    invoke-virtual {v6, v0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
    :try_end_2
    .catch Ljava/lang/Exception; {:try_start_2 .. :try_end_2} :catch_1

    goto :goto_1

    .line 61
    .end local v0           #city:Lcom/bitauto/autoeasy/selectcar/Object/City;
    .end local v1           #e:Ljava/lang/Exception;
    .end local v4           #jO:Lorg/json/JSONObject;
    .end local v5           #jObj:Lorg/json/JSONObject;
    :catch_1
    move-exception v6

    move-object v1, v6

    .line 62
    .restart local v1       #e:Ljava/lang/Exception;
    iget-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->TAG:Ljava/lang/String;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "error :"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Ljava/lang/Exception;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    .line 63
    const/4 v6, 0x0

    iput-object v6, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->list:Ljava/util/ArrayList;

    .line 65
    invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_1
.end method

.method public createCity(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/selectcar/Object/City;
    .locals 5
    .parameter "obj"

    .prologue
    .line 81
    new-instance v0, Lcom/bitauto/autoeasy/selectcar/Object/City;

    invoke-direct {v0}, Lcom/bitauto/autoeasy/selectcar/Object/City;-><init>()V

    .line 83
    .local v0, city:Lcom/bitauto/autoeasy/selectcar/Object/City;
    :try_start_0
    const-string v2, "CityId"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/City;->setCityId(Ljava/lang/String;)V

    .line 84
    const-string v2, "CityName"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v0, v2}, Lcom/bitauto/autoeasy/selectcar/Object/City;->setCityName(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v0

    .line 89
    :goto_0
    return-object v2

    .line 86
    :catch_0
    move-exception v2

    move-object v1, v2

    .line 87
    .local v1, e:Lorg/json/JSONException;
    iget-object v2, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->TAG:Ljava/lang/String;

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 88
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V

    .line 89
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public getList()Ljava/util/ArrayList;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/ArrayList",
            "<",
            "Lcom/bitauto/autoeasy/selectcar/Object/City;",
            ">;"
        }
    .end annotation

    .prologue
    .line 19
    iget-object v0, p0, Lcom/bitauto/autoeasy/selectcar/Object/CityParser;->list:Ljava/util/ArrayList;

    return-object v0
.end method
